import 'package:flutter/material.dart';
class ShowDialog{
  static void showError(BuildContext context){
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          backgroundColor: Colors.white,
          title: Text(
            '错误',
            style: TextStyle(
              color: Color(0xffc80815),
              fontSize: 24.0,
            ),
          ),
          content: Text('添加失败'),
          actions: <Widget>[
            TextButton(
              child: Text('确定', style: TextStyle(color: Colors.black)),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
  static void showErrorAndDetail(BuildContext context,String message){
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          backgroundColor: Colors.white,
          title: Text(
            '错误',
            style: TextStyle(
              color: Color(0xffc80815),
              fontSize: 24.0,
            ),
          ),
          content: Text(message),
          actions: <Widget>[
            TextButton(
              child: Text(
                '确定',
                style: TextStyle(color: Colors.black),
              ),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
  static void showCorrect(BuildContext context){
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          backgroundColor: Colors.white,
          title: Text(
            '成功',
            style: TextStyle(color: Color(0xff6486f3)),
          ),
          content: Text(
            '添加成功',
            textAlign: TextAlign.center,
          ),
          actions: <Widget>[
            TextButton(
              child: Text('确定', style: TextStyle(color: Colors.black)),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
  static void showCorrectAndDetail(BuildContext context,String message){
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          backgroundColor: Colors.white,
          title: Text(
            '成功',
            style: TextStyle(
              color: Color(0xff6486f3),
              fontSize: 24.0,
            ),
          ),
          content: Text(message),
          actions: <Widget>[
            TextButton(
              child: Text(
                '确定',
                style: TextStyle(color: Colors.black),
              ),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
}

